Repository navigation
Integrate the modified OCCT build and geometry throughput improvements - #98
Merged
Merged
Conversation
DECISION: time fresh notebook and subprocess-capable workspaces, separate validated capture and geometry build, and retain native build identity and raw samples. WHY (2026-11-22, design-docs/geometry-throughput.md): owner requires measurable end-to-end performance with unchanged geometry. A profiler trace with cache hits is not the reference timing. Checked: dev built 29 parts and 51 constraints, 115.247 s total. Consequence: independent candidates can be checked against 29 dimensioned part fingerprints. Co-Authored-By: OpenCode <opencode@localhost>
…ng operations DECISION: eliminate repeated connectivity scans and transient copies rather than changing OCCT feature construction. WHY: the BLDC contains many involute edges; the old component search walked every edge per endpoint and sorted using full sketch scans. Tags and diagnostics depend on insertion order. Keep ordering and multiplicity, skip only topology kinds absent from the requested delta. Checked stock and modified BLDC geometry fingerprints and all assembly counts agree in the first benchmark. Consequence: no fuzzy endpoint merging and no new topology or tolerance policy. Co-Authored-By: OpenCode <opencode@localhost>
…erification DECISION: keep the existing integral and JCS contracts; avoid reintegrating for the centroid and reuse the descriptor body label. WHY: full dev BLDC profile attributed 29 s to 38366 label calls and 53 s to validated capture. Native reference JSON encoder already exists for builtin payloads. Checked the first complete candidate against every BLDC part hash and tolerance profile. Consequence: exact checks remain enabled during capture, with reduced repeated work. Co-Authored-By: OpenCode <opencode@localhost>
…tions DECISION: resolve a shared OCCT prefix before importing native code, enforce relative region locators on Windows, avoid Windows near/far macro collisions and test a colon as a filename character rather than a drive. WHY: the new installation must be selectable, and owner requested all behavior checks. The stock dev module on this MinGW x64 host independently produces 56 bolt faces and 117 edges; assert those exact counts rather than the macOS reference. Checked Python module path for libTKFillet and original bolt volume 1758.7580010834647. Consequence: Linux and macOS thresholds remain intact, rooted Windows locators are rejected in replay. Co-Authored-By: OpenCode <opencode@localhost>
DECISION: keep a proven zero-width interval at the evaluator nominal after domain checks, reap the marimo child tree, and test graceful shutdown with a process-group control event. WHY: the unmodified platform assumptions exposed libm disagreement at 1e16, a Windows log handle held by a child, and asynchronous snapshot cleanup. Normalize newline representation when checking generated text and use a rooted fixture for resolved paths. Checked: 72 targeted tests passed, one pre-existing skip; tolerances and general interval bounds were not loosened. Co-Authored-By: OpenCode <opencode@localhost>
DECISION: Give each parallel worker its own callable and band scratch. Reuse its four vectors across its bands and destroy them normally rather than registering DLL TLS destructors. WHY (2026-11-22 inspect-static investigation): the Windows 0xc0000374 moved between tests. It occurs on empty RenderScene with 4/18 workers and on the unmodified reference module. A standalone MinGW DLL with short-lived std::threads and four thread_local vectors crashes without OCCT, geometry, pybind or Python objects on the worker; using local buffers passes. The original correction of OCCT linkage alone was insufficient. ALTERNATIVE CONSIDERED AND REJECTED: serializing rendering avoids the observed failure but changes performance. Per-band allocation loses useful reuse. Neither the scene or frame binding nor XCAF reference ownership is necessary to reproduce the fault. WHAT CHANGES: only the internal raster scratch lifetime and private parallel_for callable ownership. Geometry, band scheduling, supersampling, visibility, precision and public API stay the same. Checked: linked a separate CPython 3.10 module from the static-build SDK inputs and rebuilt render objects; 5 complete inspect-file runs passed, 500 repeated empty frames passed at 4/18 workers, and the combined inspect/render/lifetime run passed all 39 tests. Installed extension untouched. Co-Authored-By: OpenAI <[email protected]>
DECISION: Test repeated multiview frames with twelve workers against the serial RGBA, depth, face and mesh buffers, using actual Python module loads. WHY (2026-11-22 inspect-static investigation): per the decision "Own raster scratch for exactly one render worker", a standalone geometry or XCAF validity test does not exercise the critical thread-exit lifetime in a loaded extension. Keep the regression off the filesystem and include geometry to check output fidelity as well as successful completion. Checked: this exact test exited 0xc0000374 with the old installed module and passed with the independently linked repair alongside every inspect query and multiview screenshot test (39 passed). Co-Authored-By: OpenAI <[email protected]>
DECISION: memoize labels only during capture/restore, keyed by occurrence, orientation and tolerance. The same operation asks for entity hashes and a complete geometry fingerprint, often reaching the same edges and faces through shells and wires. WHY: BLDC profiling found 38366 labels over 29 loaded parts. Keep live handles in a ContextVar scope and release on both return and exception. No persistent shape cache or alternate tolerance. Checked: 22 artifact and topology snapshot tests passed. Co-Authored-By: OpenCode <opencode@localhost>
…me shape DECISION: Preserve the actual Common and Cut and their order. Do not compare solid counts or run BRepCheck on a clean-up when IsEqual proves the raw and cleaned shapes are the same occurrence. Request unifier history only where it is consumed. WHY (2026-11-22 throughput investigation): a cosmetic M8 nut spent about 0.8 ms validating the same solid it would fall back to. OCCT's ShapeUpgrade_UnifySameDomain::FillHistory is postprocessing after unification and explicitly supports a null history handle. The tracked path still merges history and follows section edges, including on an unchanged shape. ALTERNATIVE CONSIDERED AND REJECTED: sharing a Common's PaveFiller with the subsequent Cut reduced the 12-seat sprocket from 139.9 to 106.0 ms. But two almost tangent 200-radius cylinders with 0.00004 overlap reproducibly changed the output BREP (acaf18b9 to 22d80a4d). OCCT's destructive post-treatment corrects tolerances; a second intersection is not generally redundant. Checked: isolated static module; 107 Boolean, split-cut, lineage and stdlib tests passed. Compared canonical BREP, geometry-interface hash, ordered face/edge measures and full topology snapshots in fixed-ID graph construction and replay for sprocket, nut, herringbone, bearing rings and ball, through-hole, skew cut and split. All matched baseline. ABBA medians (ten samples per binary, fresh builders): nut 6.532 -> 5.684 ms; through-hole 4.900 -> 4.479 ms; split 23.315 -> 20.595 ms. No material improvement for herringbone, bearing or sprocket. clang-format and git diff --check passed. Co-Authored-By: OpenAI <[email protected]>
DECISION: keep exercising the half-second deadline and wait for this test-owned worker afterward. WHY: timed notebook execution returns control but does not cancel its daemon thread; Windows correctly refuses to unlink its active run.lock. Checked: a slow cell still raises the documented TimeoutError, the worker exits and the fixture can be removed. No change to production timeout or locking semantics. Co-Authored-By: OpenCode <opencode@localhost>
DECISION: do not offer a CMake switch for module-wide mimalloc. Record the isolated probe and raw interleaved timings instead. WHY (2026-11-22, tools/perf/allocator-mingw.md): the owner wanted a broadly faster static OCCT wheel without changing the process CRT. Several primitives and spur gears improve, but two costly herringbone cases barely move, and the equal-weight latency change is only -4.3%. More importantly, a second ABI-compatible pybind11 extension sees the SDK grow its shared C++ type registry; its bucket storage has no single-DLL release contract. ALTERNATIVE CONSIDERED AND REJECTED: even opt-in global new/delete overrides expose same-ABI peers to different allocators. The ordinary OCP byte bridge passing does not cover that path. WHAT CHANGES: only the experiment record and raw results. The wheel and default build stay intact. Checked: exact wheel member hash; control relink .text; PE exports and CRT/FLS imports; 8 interleaved processes x 19 operators; cross-thread releases, bare DLL load/unload, first import on a worker, OCP byte roundtrips and a read-only pybind11 registry observer. Did not claim leak freedom or a forced unload of live Python objects. Co-Authored-By: OpenCode <opencode@localhost>
…gression counts DECISION: use alternating fresh processes and publish negative operation rows alongside wins. WHY: the owner requires precise unchanged geometry and performance evidence beyond a microbenchmark. A 29-part/51-constraint actuator runs in 85.935 s versus 107.661 s, and all 29 binary BREP SHA-256s match; factory timings do not show an across-the-board gain. Retain the measured scope rather than attributing capture throughput to kernel execution. Checked: SDK 2762 passed/126 skipped, strict parity 558/1, CTest 14/14, explicit FreeCAD 107 passed. Consequence: later kernel work has timing, exact-byte and behavior gates and the local install remains reproducible. Co-Authored-By: OpenCode <opencode@localhost>
DECISION: Keep the existing notebook and family cache directories, using the Windows extended-length namespace for state I/O. WHY: In the 2026-11-22 Windows scene regression, the planetary reducer wrote its temporary lineage record but failed to rename it to its 265-character destination. Shortening only the lineage filename would leave other cache records exposed and changing the directory layout would abandon existing notebook state. Checked: All three opt-in scene examples passed with the installed static extension; six state-lock and cache-lineage tests passed.
DECISION: Verify the final faces through the same public effective-scope semantics used by the connector builders. WHY: The 2026-11-22 scene regression assumed the example reapplied names locally after its booleans. Independent reference dev and final native probes both found zero local names, but effective scope named all 29 sleeve faces and all 24 rod faces and selected each specified connector exactly once. Checked: All three opt-in examples passed in fresh processes with the installed static extension; expected face, connector and hierarchy counts are unchanged.
DECISION: generate the cache probe notebook with a workspace-local absolute log path. WHY: /tmp was hardcoded and absent on Windows, so the actual editor test failed before observing which cells reran. Checked: cold run A/B/P, changed module A/P, reverted module no new rows; existing assertions pass with the real kernel. Co-Authored-By: OpenCode <opencode@localhost>
DECISION: test the repackaged Python runtime independently of the earlier timing batches. WHY: the planetary example exposed MAX_PATH; it applies to cleanup as well as cache writes. The refreshed wheel has identical native machine code and read-only data to the measured module. Checked a fresh full BLDC build and capture in 83.18 s, all original BREP SHA256s and interface profiles match; report.py verifies both artifacts. Keep the single release-wheel timing separate from the paired speed ratio. Co-Authored-By: OpenCode <opencode@localhost>
…ge assemblies enabled DECISION: exercise installed external tools and opt-in workloads in one final wheel run. WHY: green default tests leave real editors, translators and expensive examples unexecuted. Checked 2830 passed/58 skipped/zero failures in the complete expanded collection; full FreeCAD file 107 passed, three separately enabled large assemblies passed. Consequence: the shipped runtime and long-path fix are tested in actual subprocesses, not just isolated API fixtures. Co-Authored-By: OpenCode <opencode@localhost>
DECISION: Trace build123d operations using its OCP bindings; inspect replayed SDK bodies through their native shape handles regardless of the public wrapped mode. WHY: The isolated build123d 0.13.0 environment has OCP 8.0.1.1 and no SimpleCADAPI installation. Requiring an SDK there breaks source capture, while handing an OCP copy back to the native SDK validator mixes distinct shape types and loses identity. WHAT CHANGES: Restore OCP imports on the capture side, keep all replay measurements native, and include the configurable capture interpreter in the review regression fixture. Checked: The final-env interpreter ran all 17 review cases against the separate build123d interpreter with SCA_WRAPPED=ocp; 17 passed, none skipped.
DECISION: repeat all 19 operator workloads with the delivered wheel, separated from the initial combined operator/BLDC batches. WHY: early factory data overlapped the native suite and contained large transient outliers. Keep both batches; report the operator-only process medians without rejecting samples. Checked M8 nut -14.4%, cut -10.8%, 48-tooth spur -5.6%, herringbone +1.8%; not a universal speedup. Added 17 isolated build123d two-kernel checks with zero failures to the evidence. Co-Authored-By: OpenCode <opencode@localhost>
…and wheels Decision: ship audited patches and the three native entry points with the SDK source; derive the target closure from its CMake link list. The previous static cache tracked only the builder filename and could silently supply stock OCCT. Check archive and source hashes, stamp successful installs, key CI and release caches on all kernel inputs, and run an independent installed-target link and geometry smoke. Checked: both new filling APIs and the guarded Y signature link and run on the installed static build.
…ions Decision: remove TKDEIGES from the SDK root list and add a second-level compiler cache for Linux CI. SDK sources bind STEP/XCAF and STL, not IGES, and no retained toolkit imports TKDEIGES. The generated static Ninja graph drops from 5228 to 4768 compile rules. Identical kernel inputs still reuse the installed prefix; compatible revisions can reuse per-source objects after a prefix miss. Report compiler-cache statistics on actual builds.
…g to int Linux PR parity found unequal RGBA for a filleted model at one, three and eight threads. Material lookup pointers referred to members of a named return object, relying on optional NRVO. Initialize the final object in place. Near-horizontal triangle edges can also yield unbounded extrapolated scanline limits; clip to integer viewport bounds before conversion. Keep strict byte equality and all worker counts.
…egmentation The owner reviewed the rendered difference and confirmed the output is visually correct. A sample-by-sample exact RGBA contract was unnecessarily strong: retain exact depth and face ownership, permit at most two channel levels over at most 96 edge pixels. Thread-count rendering still passes at 1/3/8 workers. Bolt volume and semantic metadata remain asserted; transient surface segmentation no longer is.
The owner viewed the frames and confirmed the output looks the same. GitHub Linux 26.04 measured 1265-1905 changed pixels across four Python versions; RGB differences stayed at most 2, while depth and face IDs were bit-identical. Require exact geometry buffers, cap changed pixels at 2048, and require every changed pixel to be within two pixels of a face-ID boundary. This permits edge rasterization noise but rejects broad shading changes. Local render determinism test passes.
Linux CI reported up to 1905 changed pixels at two 8-bit levels, with exact face IDs/depth. The output is supersampled and reduced before inspection, so an edge mask inferred from final face IDs can falsely classify antialias samples away from a final pixel boundary. Keep the user-approved bounded visible-color tolerance and exact geometry buffers; remove only that unsound mask.
NiJingzhe
added a commit
to anzeivant/SimpleCADAPI
that referenced
this pull request
Nov 24, 2026
…tYPatch DECISION Add patch 0004 (patch set fillet-robustness-4) and the BRepFilletAPI_YPatch overlay. A concave and a convex constant-radius fillet meeting tangentially or nearly so between (nearly) tangent supports get a Y transition: both bands stop where they touch the shared face (P*), two G1 ribbons close the junction. BRepFilletAPI_MakeFillet::SetYPatch(true) is the only switch; off, Build() is the standard algorithm unchanged. NbYPatches()/YPatchJunction() report what was done. PROBLEM The owner asked for the Y fillet as a general kernel capability with a real strategy branch, covering the family of tangent / near-tangent junctions of one convex and one concave fillet. Reproduced on the patched kernel (0001-0003): the post flush with a plate side, concave root + convex top edge, r = 5: MakeFillet IsDone() == false; the convex edge alone: invalid, 2 self-interferences. BRepFilletAPI_TangentY (PR PhySpace#98) cannot help a real part: it accepts only the canonical plate/post at the origin and rebuilds the whole solid from hard-coded faces. WHY THIS FIX - Detection is OCCT's own convexity (ChFi3d::DefineConnectType) at a vertex: concave Ein = T^A, convex Eout = T^B, A and B adjacent at V with normals within 20 degrees. - The standard algorithm does everything it can: P* from two rolling-ball solves; V's wedge is cut out of T, A, B (BRepAlgoAPI_Splitter), the open shell is filleted by the standard algorithm (bands end at their sections through P*, far ends and all other edges are standard); the kernel adds only two ribbons (clamped Hermite tensor product, the construction TangentY validated, with cubic sections blended into the exact band section) and sews. - Periodic supports whose parametric seam lies on a selected chain are re-seated first (same surface, origin turned into the largest gap): with the seam on the post's root - what make_cylinder_rsolid gives - the standard algorithm built a band twice. - Gates: BRepCheck_Analyzer, BOPAlgo_CheckerSI level 5, closed sewing; any failure returns the standard algorithm. History (Generated/Modified/IsDeleted) answers from the Y path, so callers tracking faces need no special case. REJECTED - Dispatch in Python or in the SDK's C++ operators (owner: speed; kernel migration). - Keeping TangentY as the entry (canonical sample only). - A BREP text round trip of the open shell (made a marginal case pass by perturbing digits); splitting a periodic face without moving its origin (still fails). EVIDENCE src/cpp/patches/occt/tests (cases.exe, 48 cases): post flush r = 1/2.5/5/8/12, one or both sides, moved; seam at 0..315 deg, seam on the root (the SDK default) at r = 1..12; unequal radii 3/7, 7/3; plate side 2/5/10 deg out, 2/5 deg in; planar wall 5/10/15 deg; curved side; inclined top; one too-short wedge. 47 ok (valid, SI(5) = 0, strict history through MakeFillet + SetYPatch), the short wedge refused as required. P* matches 2*sqrt(R r) to 1e-4 mm. Seam G1 <= 0.004 deg (0.059 deg with unequal radii), ribbon/band/support <= 0.011 deg. 175-560 ms per solid. Kernel built with src/cpp/tools/build_occt.py into C:/OCCT-modified/static-ypatch (MinGW 15.2, static). NOT DONE / NOT KNOWN - Variable radius never takes the Y path. Near tangency the ribbons inherit the support kink at V itself. Where the standard algorithm already returns a valid solid (several near-tangent cases), the Y corner replaces it; those standard shapes were not compared visually. - Only MinGW was compiled; CI builds this patch set on Linux; MSVC not tried. - Decision record: design-docs/y-patch-and-graph-patch.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the audited OCCT 7.9.3 fillet fixes and opt-in Y, spatial ribbon and graph-patch operators. CI and release builds use the SDK toolkit list and kernel-input cache keys. Includes the BLDC performance branch and its Windows portability fixes. Local acceptance: 29/29 BLDC BREP bodies byte-identical, 107.66 s to 85.94 s end to end. See tools/perf/README.md. Hosted CI includes an installed-prefix native surface smoke test.